<script setup lang="ts">
import { RouterView } from 'vue-router'
import Head from './components/head.vue'
import Foot from './components/foot.vue'
import Bread from './components/Breadcrumbs.vue'
import { ref, watchEffect } from 'vue'

let header_show = ref(true)
let footer_show = ref(true)
const footer = (bool: boolean) => {
  footer_show.value = bool
}
import { useRoute } from 'vue-router'
let route = useRoute()
const head_child = ref()
const header = (bool: boolean) => {
  header_show.value = bool
  // head_child.value.updateNav(route.query.id)
}
document.title = "明宇商城"

let bread_show = ref(true)
const bread = (value: boolean) => {
  bread_show.value = value
}
watchEffect(() => {
  if (route.path == '/' || route.path == '/login') {
    bread_show.value = false
  } else {
    bread_show.value = true
  }
  if (route.path !== '/login') {
    header_show.value = true
  }
})
</script>

<template>
  <div class="body">
    <div class="fixHeader" v-if="header_show">

      <Head ref="head_child" />
    </div>

    <!-- <div v-if="bread_show" class="bread">
    <Bread />
  </div> -->
    <div class="main">
      <RouterView v-on:header="header" v-on:footer="footer" v-on:bread="bread" />
    </div>

    <!-- <div v-if="footer_show">
    <Foot />
  </div> -->
  </div>
</template>

<style lang="scss" scoped>
@import '@/assets/style/theme.scss';

.body {
  background-color: #f7f4ef;
  height: 100%;
  width: 100%;
  min-height: 900px;
  // position: fixed;
}

.main {
  width: 1280px;
  height: auto;
  margin: 0 auto;
  // overflow: auto;
}
</style>
